<html>
<head>
<script>
  function foo(a, b, c) {
    if (arguments.length === 2) {
        // 实际拿到的参数是a和b，c为undefined
        c = b; // 把b赋给c
        b = null; // b变为默认值
    }
    for (var i=0; i<3; i++) {
        alert(arguments[i]); // 10, 20, 30
    }
  }


</script>
</head>
<body>
<script type="text/javascript">
foo(1,2);
</script>
</body>
</html>
